package cn.edu.neusoft.demo.hospital2.Service.impl;

import cn.edu.neusoft.demo.hospital2.Dao.MessageboardDao;
import cn.edu.neusoft.demo.hospital2.Service.MessageboardService;
import cn.edu.neusoft.demo.hospital2.pojo.Messageboard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class MessageboardServiceImpl implements MessageboardService {

    @Autowired
    private MessageboardDao messageboardDao;

    @Override
    public List<Messageboard> getMessageList() {
        return messageboardDao.getMessageList();
    }

    @Override
    public List<Messageboard> getMessageById(Integer userId) {
        return messageboardDao.selectById(userId); // 返回多条记录
    }


    @Override
    public int addMessage(Messageboard messageboard) {
        return messageboardDao.insert(messageboard);
    }

    @Override
    public int updateMessage(Messageboard messageboard) {
        return messageboardDao.updateById(messageboard);
    }

    @Override
    public int deleteMessageById(Integer messageId) {
        return messageboardDao.deleteById(messageId);
    }
}
